using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.Logging.Data.Controllers.Interfaces;
using T2.Logging.Data.Entities.Interfaces;
using T2.Logging.Business.Entities.Interfaces;
using T2.Logging.Business.Entities;
using T2.Logging.Data.Controllers;
using T2.Logging.Business.Builders.Interface;
using T2.Logging.Business.Translators;
using T2.Logging.Business.Entities.Search.Interfaces;
using T2.Logging.Data.Entities.Search.Interfaces;


//--Change Management Control - Tenant Builder  --**********************
//--Created By: trooks
//--Description: Tenant Builder Class
//--Created Date: 03/07/2013 10:05:39
//--*************************************************************

namespace T2.Logging.Business.Builders
{
	public partial class Tenant_Builder : ITenant_builder 
	{
		
	public List<ITenant_biz> BuildParts (ITenant_biz _param)
	{
			ITenant_biz temp = new Tenant_biz();
			ITenantController cont = new TenantController();
			List<ITenant_biz> tempList = new List<ITenant_biz>();
			List<ITenant> tempData = new List<ITenant>();
			switch (_param.Action)
			{
				case "GetOne":
				temp = TenantTranslator.TranslateFromDataLayer(cont.Tenant_GetOne(TenantTranslator.TranslateToDataLayer(_param)));
				tempList.Add(temp);
				return tempList;

				case "GetAll":
				tempData = cont.Tenant_GetAll(TenantTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => TenantTranslator.TranslateFromDataLayer(p)).Cast<ITenant_biz>().ToList();
				return tempList;

			}
			return tempList;
}
	public List<ITenant_biz> BuildParts (ITenantSearch_biz _param)
	{
			ITenant_biz temp = new Tenant_biz();
			ITenantController cont = new TenantController();
			List<ITenant_biz> tempList = new List<ITenant_biz>();
			List<ITenant> tempData = new List<ITenant>();
			tempData = cont.Tenant_Search(TenantTranslator.TranslateSearchToDataLayer(_param));
			tempList = tempData.Select(p => TenantTranslator.TranslateFromDataLayer(p)).Cast<ITenant_biz>().ToList();
			return tempList;

	}
		
	}
}
